<?php
/**
 *  发布管理
 *  仲伟涛 2011-4-24
 */
class Dream_Page_Cms_Create extends Dream_Page_Abstract
{
    public function validate(ME_Request $input, ME_Response $output)
    {
        //$input->doJump = true;
        //$adminInfo = Libs_UcUser::getAdminLoginInfo($input,$output);

        $output->appId = $input->appId  = 1;
        return true;
    }

    private $db;
    private $tblTitleName = 'cms_document_title_';
    private $tblContentName = 'cms_document_content_';
    private function loadDb()
    {
        $this->db = Db_Admin::instance();
    }

    public function doDefault(ME_Request $input, ME_Response $output)
    {

        
    }
    
    //生成右侧区域
    public function doRight(ME_Request $input, ME_Response $output)
    {
        $this->loadDb();
        //获得最新的文章
        $param = array(
            'appId'   => 1,
            'cnt'     => 10, #默认已经发布
            'orderBy' => ' order by datetm desc ',
        );
        $output->newData = Libs_Cms_Document::getDocumentList($param);

        //获得最热的文章
        $param = array(
            'appId'   => 1,
            'cnt'     => 10, #默认已经发布
            'hourbwn' => 7*24, #默认已经发布
            'orderBy' => ' order by hits desc ',
        );
        $output->hotData = Libs_Cms_Document::getDocumentList($param);
        $tpl = 'Cms/DocumentRight';
        $output->setTemplate($tpl);
        $html = $output->fetch();
        $path = PRODUCTION_ROOT . "/Html/".APP_NAME."/inc/listRight.html";
        ME_File::write($html, $path);
        $path = PRODUCTION_ROOT . "/Html/".APP_NAME."/inc/documentRight.html";
        ME_File::write($html, $path);
        echo "ok";exit;
//Libs_GlobalFunc::haltMsg("右侧区块 发布成功！",array('stop'=>1));
    }
    
}
